﻿namespace Borg
{
    public sealed class ExtensionLogger
    {
        private readonly Logger _logger;
        private readonly Extension _extension;

        internal ExtensionLogger(Logger logger, Extension extension)
        {
            _logger = logger;
            _extension = extension;
        }

        public void Log(string message, params object[] args)
        {
            InternalLog(VerbosityLevel.Normal, new LogArgs(LogType.Info, _extension, message, args));
        }

        public void Log(LogType type, string msg, params object[] args)
        {
            InternalLog(VerbosityLevel.Normal, new LogArgs(type, _extension, msg, args));
        }

        public void Log(VerbosityLevel verbosityLevel, string msg, params object[] args)
        {
            InternalLog(verbosityLevel, new LogArgs(LogType.Info, _extension, msg, args));
        }

        public void Log(VerbosityLevel verbosityLevel, LogType type, string msg, params object[] args)
        {
            InternalLog(verbosityLevel, new LogArgs(type, _extension, msg, args));
        }

        public void Log(VerbosityLevel verbosityLevel, LogArgs args)
        {
            InternalLog(verbosityLevel, args);
        }

        private void InternalLog(VerbosityLevel verbosityLevel, LogArgs args)
        {
            _logger.Log(verbosityLevel, args);
        }
    }
}
